<?php
	class UtilityHelper extends AppHelper {

		var $helpers = array('Time');

		//calculate years of age (input string: YYYY-MM-DD)
		  function birthday ($date){
			$date = date("Y-m-d", $this->Time->toUnix($date));
		    list($year,$month,$day) = explode("-",$date);
		    $year_diff  = date("Y") - $year;
		    $month_diff = date("m") - $month;
		    $day_diff   = date("d") - $day;
		    if ($day_diff < 0 || $month_diff < 0)
		      $year_diff--;
		    return $year_diff;
		  }
	}
?>